package com.yan.responsibility_chain;

import java.util.LinkedHashMap;
import java.util.Map;

public interface Handler {
    ThreadLocal<Map<String, String>> REMARK = new ThreadLocal<Map<String, String>>() {{
        set(new LinkedHashMap<>());
    }};

    Integer getHandleLevel();

    Handler getNextHandler();

    void handle(Integer requiredLevel, String message);

    default void handle(String message) {
        handle(Integer.MIN_VALUE, message);
    }

    default void report() {
        REMARK.get().forEach((k, v) -> System.out.println(k + ":" + v));
    }
}
